<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('技术案例库列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>零件名称：</label>
                                <input type="text" name="partName"/>
                            </li>
                            <li>
                                <label>故障模式：</label>
                                <select name="failureMode" th:with="type=${@dict.getType('sys_failure_mode')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>材料牌号：</label>
                                <input type="text" name="materialBrand"/>
                            </li>
                            <li>
                                <label>信息来源：</label>
                                <input type="text" name="informationSource"/>
                            </li>
                            <li>
                                <label>创建时间：</label>
                                <input type="text" class="time-input" placeholder="请选择" name="createdAt"/>
                            </li>

                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">

                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="technical:technical:export">
                    <i class="fa fa-download"></i> 下载
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('technical:technical:edit')}]];
        var removeFlag = [[${@permission.hasPermi('technical:technical:remove')}]];
        var failureModeDatas = [[${@dict.getType('sys_failure_mode')}]];
        var prefix = ctx + "technical/technical";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                detailUrl: prefix + "/detail/{id}",
                modalName: "技术案例库",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '',
                    visible: false
                },
                {
                    field: 'partName',
                    title: '零件名称'
                },
                {
                    field: 'failureMode',
                    title: '故障模式',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(failureModeDatas, value);
                    }
                },
                {
                    field: 'industryId',
                    title: '故障类型'
                },
                {
                    field: 'failureInfo',
                    title: '失效信息'
                },
                    {
                        field: 'materialType',
                        title: '材料类型'
                    },
                {
                    field: 'materialBrand',
                    title: '材料牌号'
                },
                {
                    field: 'informationSource',
                    title: '信息来源'
                },
                {
                    field: 'failureReason',
                    title: '故障原因'
                },
                {
                    field: 'basicSituation',
                    title: '基本情况'
                },
                {
                    field: 'caseFullText',
                    title: '案例全文'
                },
                {
                    field: 'createdAt',
                    title: '创建时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.detail(' + row.id + ')"><i class="fa fa-edit"></i>浏览</a> ');

                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>